package diablo3;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import diablo3.support.Util;


public class KeepAMFConnect {
	
	private static final Log LOG = LogFactory.getLog(KeepAMFConnect.class);
	
	public void connect(){
		String url = "http://209.205.76.133:779/test";
		HttpClient client = new HttpClient();
		GetMethod method = new GetMethod(url);
		try {
			client.executeMethod(method);
		} catch (Exception e) {
			LOG.error(e.getMessage());
		}
	}
	
	public void connectLoop(){
		LOG.info("启动循环请求AMF服务器程序");
		new Thread(){
			@Override
			public void run() {
				while(true){
					connect();
					Util.threadSleep(120);
				}
			};
		}.start();
	}
	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		KeepAMFConnect amfConnect = new KeepAMFConnect();
		amfConnect.connectLoop();
}

}
